/*
 * @FilePath: /tads/server/cmd/api/server.go
 * @Author: wnina0x0
 * @Date: 2025-04-09 11:49:29
 * @Description:
 *
 * 版权信息 : 2025 by wnina0x0, All Rights Reserved.
 */
package api

import (
	"flag"
	"fmt"
	"os"
	"tads/server/cmd/app"
	"tads/server/global"
)

var (
	h bool
	s string
)

func init() {
	flag.BoolVar(&h, "h", false, "帮助")
	flag.StringVar(&s, "s", "", "模式：server migrate")
	flag.Usage = usage
}

func Execute() {
	global.TADS_LOG.Info("Start\n")
	flag.Parse()

	if h {
		flag.Usage()
		return
	} else if s != "" {
		start := app.StartRun{}
		start.Mode = s
		start.Start()
	}

}
func usage() {
	fmt.Fprintf(os.Stderr, `tads version: 1.0.0
Usage: tads [-hs] [-s server/migrate]

Options: server 是服务端 migrate 数据库初始化
`)
	flag.PrintDefaults()
}
